import { createRouter, createWebHistory } from 'vue-router'
import Home from "@/views/Home.vue"

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "Home",
    component: Home,
  },
  {
    path: "/list",
    name: "List",
    component: () => import("@/views/List.vue"),
  },
  {
    path: "/cart",
    name: "Cart",
    component: () => import("@/views/Cart.vue"),
  },
  {
    path: "/my",
    name: "My",
    component: () => import("@/views/My.vue"),
  },
  {
    path: "/search",
    name: "Search",

    children: [
      {
        path: "",
        name: "index",
        component: () => import("../views/search/Search-index.vue"),
      },
      {
        path: "list",
        name: "list",
        component: () => import("../views/search/Search-list.vue"),
      },
    ],
  },
  {
    path: "/detail",
    name: "Detail",
    component: () => import("@/views/Detail.vue"),
  },
  {
    path: "/:pathMatch(.*)*",
    name: "NotFound",
    component: () => import("@/views/404.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
